//
//  IMChatInteractor.m
//  ChatMainDemo
//
//  Created by peiw on 16/1/21.
//  Copyright © 2016年 peiw. All rights reserved.
//

#import "IMChatInteractor.h"
#import "IMChatMessage.h"
#import "IMChatMessageManager.h"

@interface IMChatInteractor ()

@property (nonatomic , strong) IMChatMessageManager *dataManager;

@end

@implementation IMChatInteractor

- (instancetype)initWithDataManager:(IMChatMessageManager *)dataManager
{
    self = [super init];
    if (self) {
        self.dataManager = dataManager;
    }
    return self;
}

- (void)findUpcomingMessage {
    //TODO: - server
    IMChatMessage *msg = [IMChatMessage new];
    msg.userID = @"2016012101";
    msg.peerID = @"2016012101";
    msg.content = @"哈罗";
    IMChatMessage *msg1 = [IMChatMessage new];
    msg1.userID = @"2016012101";
    msg1.peerID = @"2016012102";
    msg1.content = @"哈罗1哈罗哈罗哈罗哈罗哈罗哈罗哈罗哈罗哈罗哈罗哈罗哈罗哈罗";
    NSArray *msgs = @[msg , msg1];
    if (canSafePerformSelector(self.output, @selector(foundUpcomingMessages:))){
        [self.output foundUpcomingMessages:[self.dataManager chatDisplayFrom:msgs]];
    }
}

@end
